Vue.filter("setDate", function(value) {
  Date.prototype.toLocaleString = function() {
    return this.getFullYear() + "年" + ((this.getMonth() >= 1 && this.getMonth() <= 9) ? "0" + this.getMonth():this.getMonth()) + "月" + ((this.getDate() >= 1 && this.getDate() <= 9) ? "0" + this.getDate():this.getDate()) + "日 ";
  };
  var unixTimestamp = new Date(value) ;
  return unixTimestamp.toLocaleString();
});

Vue.filter("filterGetDate", function(value) {
  if(value && value >= 0){
    Date.prototype.toLocaleString = function() {
      return this.getFullYear() + "-" + ((this.getMonth()+1 >= 1 && this.getMonth()+1 <= 9) ? "0" + (this.getMonth()+1):this.getMonth()+1)
    };
    var unixTimestamp = new Date(value) ;
    return unixTimestamp.toLocaleString();
  }else{
    return '-';
  }
});
Vue.filter("filterDateForDay", function(value) {
  if (value && value >=0) {
    Date.prototype.toLocaleString = function() {
    return this.getFullYear() + "年" + ((this.getMonth()+1 >= 1 && this.getMonth()+1 <= 9) ? "0" + (this.getMonth()+1):this.getMonth()+1) + "月" +((this.getDate() >= 1 && this.getDate() <= 9) ? "0" + this.getDate():this.getDate()) + '日'
    };
    var unixTimestamp = new Date(value) ;
    return unixTimestamp.toLocaleString();
  }else{
    return '-'
  }
});
Vue.filter("filterDateForMonth", function(value) {
  if (value && value >= 0) {
    Date.prototype.toLocaleString = function() {
      return this.getFullYear() + "年" + ((this.getMonth()+1 >= 1 && this.getMonth()+1 <= 9) ? "0" + (this.getMonth()+1):this.getMonth()+1) + '月'
    };
    var unixTimestamp = new Date(value) ;
    return unixTimestamp.toLocaleString();
  }else{
    return '-'
  }
  // Date.prototype.toLocaleString = function() {
  //   return this.getFullYear() + "年" + ((this.getMonth()+1 >= 1 && this.getMonth()+1 <= 9) ? "0" + (this.getMonth()+1):this.getMonth()+1) + '月'
  // };
  // var unixTimestamp = new Date(value) ;
  // return unixTimestamp.toLocaleString();
});

Vue.filter("filterGetTime", function(value) {
  var date = new Date(value);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
  year = date.getFullYear().toString();
  Y = year.substring(year.length-2,year.length) + '/';
  M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '/';
  D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' ';
  h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':';
  m = (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes()) + ':';
  s = (date.getSeconds() < 10 ? '0'+date.getSeconds() : date.getSeconds());
  return Y+M+D+h+m+s;
});

Vue.filter("filterGetDateForDay", function(value) {
  Date.prototype.toLocaleString = function() {
    return this.getFullYear() + "-" + ((this.getMonth()+1 >= 1 && this.getMonth()+1 <= 9) ? "0" + (this.getMonth()+1):this.getMonth()+1) + "-" +((this.getDate() >= 1 && this.getDate() <= 9) ? "0" + this.getDate():this.getDate())
  };
  var unixTimestamp = new Date(value) ;
  return unixTimestamp.toLocaleString();
});

Vue.filter("filterImageName", function(value) {
  switch(value)
    {
    case 'vin':
      return 'VIN';
      break;
    case 'right_rear':
      return '右后';
      break;
    case 'driving_seat':
      return '驾驶座椅';
      break;
    case 'control_booth':
      return '控制室';
      break;
    case 'odograph':
      return '里程表';
      break;
    case 'left_anterior':
      return '左前（首图）';
      break;
    case 'open_trunk':
      return '打开后备箱';
      break;
    case 'engine_bay':
      return '发动机全景';
      break;
    case 'right_side':
      return '右侧';
      break;
    case 'tyre':
      return '轮胎';
      break;
    case 'insurance':
      return '保单';
      break;
    case 'registration_license':
      return '登记证';
      break;
    case 'vehicle_license':
      return '行驶证';
      break;

      //抵押图片
    case 'pledge_vehicle_license':
      return '行驶证';
      break;
    case 'pledge_registration_license':
      return '登记证';
      break;
    case 'pledge_keys':
      return '车钥匙';
      break;
    case 'pledge_invoice':
      return '发票';
      break;
    case 'pledge_insurance':
      return '保单';
      break;
    case 'pledge_duty_paid':
      return '完税凭证';
      break;
    default:
      return '无';
      break;
    }
});


Vue.filter("filterCarStockState", function(value) {
  switch(value)
    {
    case 0:
      return '未入库';
      break;
    case 10:
      return '入库中';
      break;
    case 20:
      return '已入库';
      break;
    case 30:
      return '出库中';
      break;
    case 40:
      return '已出库';
      break;
    default:
      return '无';
      break;
    }
});

Vue.filter("filterCarDetectState", function(value) {
  switch(value)
    {
    case 0:
      return '未检测';
      break;
    case 10:
      return '检测中';
      break;
    case 20:
      return '检测完毕';
      break;
    default:
      return '无';
      break;
    }
});
Vue.filter("filterCarSaleState", function(value) {
  switch(value)
    {
    case 0:
      return '未上架';
      break;
    case 10:
      return '上架中';
      break;
    case 20:
      return '已上架';
      break;
    case 30:
      return '已下架';
      break;
    default:
      return '无';
      break;
    }
});
Vue.filter("filterCarAuthState", function(value) {
  switch(value)
    {
    case 0:
      return '未认证';
      break;
    case 10:
      return '已认证';
      break;
    default:
      return '无';
      break;
    }
});


Vue.filter("filterCarOrderState", function(value) {
  switch(value)
    {
    case 0:
      return '未预订';
      break;
    case 1:
      return '已预订';
      break;
    default:
      return '无';
      break;
    }
});

// 付款类型
Vue.filter("filterSalePayType",function(value){
  switch(value)
  {
      case 1:
          return '现款'
          break
      case 2:
          return '按揭'
          break
      default:
          return ''
          break
  }
})

// 销售类型
Vue.filter("filterSaleType",function(value){
  switch(value)
  {
      case 1:
          return '批发'
          break
      case 2:
          return '直销'
          break
      case 3:
          return '拍卖'
          break
      default:
          return ''
          break
  }
})

// 代办保险
Vue.filter("filterSaleInsuranceState",function(value){
  switch(value)
  {
      case 1:
          return '代办'
          break
      case 0:
          return '不代办'
          break
      default:
          return ''
          break
  }
})

// 抵押状态
Vue.filter("filterCarPledgeState",function(value){
  switch(value)
  {
      case 300:
          return '未抵押'
          break
      case 310:
          return '已抵押'
          break
      default:
          return '无抵押状态'
          break
  }
})

// 在场状态
Vue.filter("filterCarSiteState",function(value){
  switch(value)
  {
      case 400:
          return '未入场'
          break
      case 410:
          return '已入场'
          break
      case 420:
          return '出场审核中'
          break
      case 430:
          return '出场审核通过'
          break
      case 440:
          return '已出场'
          break
      default:
          return '无出场状态'
          break
  }
})

